package games.padinvaders;

import graphics.Sprite2D;
import hardware.Display2D;

public class SpaceShip extends Sprite2D{

	
public static final int STATUS_ARIVE 		= 0;
public static final int STATUS_ALIVE 		= STATUS_ARIVE+1;
public static final int STATUS_DESCENDING	= STATUS_ALIVE+1;
public static final int STATUS_FALLING_A	=STATUS_DESCENDING+1;
public static final int STATUS_FALLING_B	=STATUS_FALLING_A+1;
public static final int STATUS_EXPLODING_A	=STATUS_FALLING_B+1;
public static final int STATUS_EXPLODING_B	=STATUS_EXPLODING_A+1;

public static final int STATUS_EXPLODED		=STATUS_EXPLODING_B+1;	
public static final int STATUS_KILLED		=STATUS_EXPLODED+1;


int status;	
	
	
protected int lifePoints;
protected int shieldStrength;

protected int energy;
protected int shootCost;

protected int shieldStrengthMax;

protected boolean shield;



public void explodeA()
{
	
	short color;
	
	
	switch (animationCounter)
	{
	case 0:
	case 1:
	case 2:
	case 3:
	case 4:
	case 5:
	case 6:
		color=(short) (0x03+(0x22+animationCounter));
		Display2D.setPixel((byte)xPos,(byte) yPos, (short)color);
		break;

	case 7:
	case 8:
	case 9:
	case 10:
		color=(short) (0x03+(0x22*animationCounter));
		Display2D.setPixel((byte)xPos,(byte) yPos, color);

		color= (short) (0x03+(0x22*(animationCounter-7)));
		Display2D.setPixel((byte)xPos,(byte) yPos, color);
	
		break;


		
	default:
			status=STATUS_EXPLODED;
			break;
		
	}
	
	animationCounter++;		
	

}
	


public void explodeB()
{

	short color;
	
	switch (animationCounter)
	{
	case 0:
	case 1:
	case 2:
	case 3:
	case 4:
	case 5:
	case 6:
		color=(short) (0x35+(0x11*animationCounter));
		Display2D.setPixel((byte)xPos,(byte) yPos, color);
		break;

	case 7:
	case 8:
	case 9:
	case 10:
		color=(short) (0x35+(0x11*animationCounter));
		Display2D.setPixel((byte)xPos,(byte) yPos, color);

		color= (short)(0x35+(0x11*(animationCounter-7)));
		Display2D.setPixel((byte)xPos+1,(byte) yPos, color);
		Display2D.setPixel((byte)xPos-1,(byte) yPos, color);
	
		break;


	
		
	default:
			status=STATUS_EXPLODED;
			break;
		
	}
	
	animationCounter++;	
}




public boolean isAlive()
{
	
	switch(status)
		{
		case STATUS_ARIVE:
		case STATUS_ALIVE: 			
		case STATUS_DESCENDING:
			return(true);
		
		}
	
		
	return(false);	
}

/**
 * @author Tavin
 * 
 * 
 * 
 * @return
 */
public int getLifePoints()
{
	return(lifePoints);
}


/**
 * @author Tavin
 * 
 * 
 * @param lifePoints
 */

public void setLifePoints(int lifePoints)
{
	this.lifePoints=lifePoints;
}


}
